
	var date={};
	
date.getMonthData = function (year, month, remain_date){
		var yet = [];  // 数组用来返回结果，数组中的每一个元素就是当前月份的每一个日期
		
		if(!year || !month){
			var today = new Date();
			year = today.getFullYear();
			month = today.getMonth()+1;
			}
		
			// 当月第一天
			var firstDay = new Date(year, month-1,1); //当月第一天
			var firstDayWeekDay = firstDay.getDay();  //当月1号的星期			
			if(firstDayWeekDay === 0 ) firstDayWeekDay = 7;
			
			//日历第一行显示上一日的日期	
			var lastDayOfLastMonth = new Date(year,month -1, 0); // 上个月的最后一天
			var lastDateOfLastMonth = lastDayOfLastMonth.getDate();
			var preMonthDayCount = firstDayWeekDay - 1;  // 第一行显示上月的日期
			
			//当月最后一天
			var lastDay = new Date(year, month, 0 ); // 当月最后一天
			var lastDate = lastDay.getDate();
    //   var lastDayWeekDay = lastDay.getDay()

      // 当月日期显示几行
      var weekcount = 5;
      if (lastDate % 7 === 0 && firstDayWeekDay === 1){
          weekcount = 4
      } else if (lastDate % 7 === 3 && firstDayWeekDay >= 6){
        weekcount = 6
      } else if (lastDate % 7 === 2 && firstDayWeekDay >= 7) {
        weekcount = 6
      } else{
        weekcount = 5
      }

      let dates_len
      if(remain_date){
        dates_len = preMonthDayCount + remain_date
      }else{
        dates_len = 7 * weekcount;
      }

      for (var i = 0; i < dates_len;i++) {
				
				var date = i + 1 - preMonthDayCount;
				var showDate = date; // 用于日期显示
				var thisMonth = month;
				
				
				
				if(date <= 0){
					// 上一月
					thisMonth = month - 1;
					showDate = lastDateOfLastMonth + date; // 上月日期
				}else if(date > lastDate){
					// 下一月
					thisMonth = month + 1;
					showDate = showDate - lastDate;
				}
				
				if(thisMonth === 0) thisMonth = 12;
				if(thisMonth === 13) thisMonth = 1;
				
				yet.push({
					month:thisMonth,
					date:date,
					showDate:showDate
				})
			}
			
			return yet;
		
		
	}
	
	
	
	
	
	
	
	


export default date;
